Collaborative Software Development

A Gentle Introduction to Git and GitHub

Jason Freels

04 January 2018

Overview

This presentation covers the following concepts

Getting Started with Git & Github

What is Git?

What is GitHub?

Why Should You use Git and GitHub?

For a fast, easy, and stress-free workflow

Your workflow - without Git

Your workflow - with Git


OK, I'm interested in using Git/Github how do I get Started

Installing Git

Configuring Git

Setting up a GitHub account

Version Control Systems

The Basics of Version Control Systems

What are version control systems?

Why should some use a version control system?

What is a Centralized Version Control System (CVCS)?

What is a Decentralized (aka Distributed) Version Control System (DVCS)?

What are the advantages of using a DVCS instead of a CVCS?

Using Git

Is Git hard to learn?

Using Git

Methods of Using Git

Which method should you choose?

Installing Git

Installing Git (Mac/linux/unix)

Installing Git (windows)

Setting Git up for the first time

$ git config --global user.name "Brandon Greenwell" $ git config --global user.email greenwell.brandon@gmail.com

The basic process

The basic commands you'll use/need

Using Git commands

add <- function(x, y) { x * y }

Initializing a repo in an existing directory

cd C:/Users/greenweb/Desktop/arithmetic
git init

Tip: the command line has a history (just like the R console), so you don't need to type as often; just hit the up arrow and make any necessary changes!

Initializing a repo in an existing directory

If you want to start version controlling all the files, you need to start tracking them. In the terminal, type the following:

then type:

How to use Git

GitHub

Account setup and configuration

The first thing you need to do is set up an account: https://github.com/

Use the same e-mail address you used when setting up Git!

Set up your profile

Creating a new repo

Creating a new repo

Creating a new repo

Creating a new repo

Creating a new repo

Refresh your browswer and see if it worked!

Making changes and pushing them to GitHub

Fix the obvious typo in add.R. Then, take a snapshot (i.e., git add/commit) and push the changes to GitHub (i.e., git push)!

Refresh your browser to see the changes.

Tip: It's good practice to do this every time you make a key change (e.g., fix a typo, add a new function to an R script, etc.).

* Make sure you're in the right directory!

All done!

Any questions?